//
//  WZGAddressUploadIdentityCell.m
//  ZCJZ
//
//  Created by sujeking on 2019/9/11.
//  Copyright © 2019 jeking. All rights reserved.
//

#import "WZGAddressUploadIdentityCell.h"
#import <BlocksKit+UIKit.h>
#import <UIButton+WebCache.h>

@interface WZGAddressUploadIdentityCell()

@property (weak, nonatomic) IBOutlet UIButton *leftBtn;
@property (weak, nonatomic) IBOutlet UIButton *rightBtn;

@end


@implementation WZGAddressUploadIdentityCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupSubViews];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
}

- (void)setupSubViews {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self.leftBtn setImage:[UIImage imageNamed:@"address_identy_up"] forState:UIControlStateNormal];
    [self.rightBtn setImage:[UIImage imageNamed:@"address_identy_back"] forState:UIControlStateNormal];
    
    self.leftBtn.layer.shadowColor = [UIColor grayColor].CGColor;
    self.leftBtn.layer.shadowOffset = CGSizeMake(0, 2);
    self.leftBtn.layer.shadowOpacity = 0.5;
    
    self.rightBtn.layer.shadowColor = [UIColor grayColor].CGColor;
    self.rightBtn.layer.shadowOffset = CGSizeMake(0, 2);
    self.rightBtn.layer.shadowOpacity = 0.5;
    
    
    [self.leftBtn bk_addEventHandler:^(id sender) {
        if (self.leftBtnClickCallback) {
            self.leftBtnClickCallback();
        }
    } forControlEvents:UIControlEventTouchUpInside];

    [self.rightBtn bk_addEventHandler:^(id sender) {
        if (self.rightBtnClickCallback) {
            self.rightBtnClickCallback();
        }
    } forControlEvents:UIControlEventTouchUpInside];
}

- (void)setLeftURL:(NSString *)leftURL {
    if (leftURL == nil || leftURL.length == 0) {
        return;
    }
    _leftURL = leftURL;
    [self.leftBtn sd_setImageWithURL:[NSURL URLWithString:leftURL] forState:UIControlStateNormal];
}

- (void)setRightURL:(NSString *)rightURL {
    if (rightURL == nil || rightURL.length == 0) {
        return;
    }
    _rightURL = rightURL;
    [self.rightBtn sd_setImageWithURL:[NSURL URLWithString:rightURL] forState:UIControlStateNormal];
}

@end
